package com.example.demo.设计模式.策略模式;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * @description:
 * @projectName:demo
 * @see:设计模式.策略模式
 * @author:袁成龙
 * @createTime:2020/10/13 10:18
 * @version:1.0
 */
public class GongCHang {

    private static Map<Integer, CelueInterface> celueMap = new HashMap<>();

    public static CelueInterface getcelue(int status) {
        System.out.println("GongCHang" + status);
        int size = celueMap.size();
        System.out.println("====="+size);
        System.out.println(celueMap.get(0));
        return celueMap.get(status);
    }


    public static void rege(int status, CelueInterface celueInterface) {
        celueMap.put(status, celueInterface);
        int size = celueMap.size();
        Iterator<Map.Entry<Integer, CelueInterface>> iterator = celueMap.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<Integer, CelueInterface> next = iterator.next();
            System.out.println("key= " + next.getKey() + " and value= " + next.getValue());
        }
    }

}